import pymysql


class LinkSql:
    host = '127.0.0.1'
    port = 3306
    username = 'root'
    password = '123456789'
    db = 'myblog'
    timeout = 5

    def __init__(self):
        self.db = pymysql.connect(host=self.host, port=self.port, user=self.username, password=self.password,
                                  db=self.db, connect_timeout=self.timeout)
        self.sesson = self.db.cursor(cursor=pymysql.cursors.DictCursor)

    def __del__(self):
        self.sesson.close()
        self.db.close()
